package com.ruoyi.media.forestApi;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.callback.OnLoadCookie;
import com.dtflys.forest.http.ForestResponse;

import java.util.Map;

/**
 * 创建微信公众号账号
 */
@BaseRequest(
    baseURL = "https://mp.weixin.qq.com", // 默认域名
    headers = {
        "Accept-Encoding: gzip",
        "referer:https://mp.weixin.qq.com/",// 默认请求头
        "userAgent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36",
        "xRequestedWith:XMLHttpRequest"
    }
)
public interface WechatMpCreateApi {


    /**
     * 注册公众号登录接口
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/cgi-bin/bizlogin?action=startlogin")
    ForestResponse accountLogin(@Body Map<String,Object> params);


    /**
     * 注册第一步 -- 保存国家信息
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/acct/registerpage?action=savecountry")
    String savecountry(@Body Map<String,Object> params, OnLoadCookie onLoadCookie);

    /**
     * 注册第二步 -- 保存数据
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/acct/registerpage")
    String saveRegisterpage(@Body Map<String,Object> params, OnLoadCookie onLoadCookie);



    /**
     * 获取二维码ticket
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/cgi-bin/mastersafeqrcode?action=getticket")
    String getticket(@Body Map<String,Object> params, OnLoadCookie onLoadCookie);


    //=======================================================================================



    /**
     * 注册第三步 -- (获取法人信息二维码)
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Get(url = "/cgi-bin/mastersafeqrcode?action=getqrcode&" +
        "qrcheck_ticket=${ticket}&random=${timestamp}&size=120&token=&lang=zh_CN")
    ForestResponse getQRCode(@Var("ticket")String ticket ,@Var("timestamp")Long timestamp, OnLoadCookie onLoadCookie);


    /**
     * 注册第三步 -- (获取扫码结果)
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Get(url = "/cgi-bin/mastersafeqrcode?action=ask&token=&lang=zh_CN&f=json&ajax=1&random=${random}&qrcheck_ticket=${ticket}")
    String getQRCodeRes(@Var("ticket")String ticket ,@Var("random")double random, OnLoadCookie onLoadCookie);


    //========================================================================================


    /**
     * 获取管理员手机验证码
     * @param params
     * @param onLoadCookie
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/acct/formbyticket")
    String getSystemPhoneCache(@Body Map<String,Object> params, OnLoadCookie onLoadCookie);




    /**
     * 公众号批量提交注册接口
     * @param params
     * @param onLoadCookie
     * @return
     */
    @HTTPProxy(host = "j735.kdltps.com", port = "15818")
    @Post(url = "/acct/contractorsubmit")
    String contractorsubmit(@Body Map<String,Object> params, OnLoadCookie onLoadCookie);


    /**
     * 获取他信token
     * @return
     */
    @Get(url = "http://api.my531.com/Login/?username=aadd1122&password=aadd112233")
    String loginTX();

    /**
     * 获取他信手机号
     * @return
     */
    @Get(url = "http://api.my531.com/GetPhone/?token=${token}&id=13682&phone=${phone}")
    String getPhoneNumber(@Var("token")String token,@Var("phone")String phone);


    /**
     * 获取他信手机号验证码
     * @return
     */
    @Get(url = "http://api.my531.com/GetMsg/?token=${token}&id=13682&phone=${phone}")
    String getPhoneCache(@Var("token")String token,@Var("phone")String phone);



}
